layui.define(['http'], function (exports) {
  var http = layui.http;
  var obj = {
    async getUserInfo() {
      const url = `/Identity/User/Info`;
      let response = await http.reqAwait(url);
      return response;
    },
    async getRole() {
      const url = `/Identity/User/Role`;
      let response = await http.reqAwait(url);
      return response.data;
    },
    async findAllUser() {
      const url = `/Identity/User/List`;
      let response = await http.reqAwait(url);
      return response.data;
    },

    async listIn(idList) {
      const url = `/Identity/User/ListIn`;
      let response = await http.reqAwait(url, idList, "post");
      return response;
    },
    async findAllUserPage(pageIndex, pageSize = 20) {
      const url = `/Identity/User/PageList?PageIndex=${pageIndex}&PageSize=${pageSize}`;
      let response = await http.reqAwait(url);
      return response;
    },
    async addTeacherUser(req) {
      const url = `/Identity/User/Teacher`;
      let response = await http.reqAwait(url, req, "post");
      return response;
    },

    async addStudentUser(req) {
      const url = `/Identity/User/Student`;
      let response = await http.reqAwait(url, req, "post");
      return response;
    },

    async getTeacher(id) {
      const url = `/Identity/User/Teacher/${id}`;
      let response = await http.reqAwait(url);
      return response;
    },
    async addAdminUser(req) {
      const url = `/Identity/User/Admin`;
      let response = await http.reqAwait(url, req, "post");
      return response;
    },
    async getAdmin(id) {
      const url = `/Identity/User/Admin/${id}`;
      let response = await http.reqAwait(url, "get");
      return response;
    }
  };

  // 导出模块
  exports('identityApi', obj);
});